import datetime
import time


def _str(sec):
    sec_dt = datetime.datetime.fromtimestamp(sec)
    if sec_dt <= datetime.datetime.now():
        return '已截止'

    t = sec_dt - datetime.datetime.now()
    if t.days:
        return "%d天" % t.days

    mm, ss = divmod(t.seconds, 60)
    hh, mm = divmod(mm, 60)
    if hh:
        return "%d小时" % hh
    if mm:
        return "%d分钟" % mm
    if ss:
        return "%d秒" % ss


# print(_str(1636686195))
print(time.time())
print(_str(1637725235))
print(_str(1637725002))
